Skip to content

Conversation

he1senbrg
Copy link

Fixes #1822

Large values such as 1920×35791423 px cause integer overflow. This patch fixes the overflow by using saturating multiplication operations in the damage shaper.

@YaLTeR
Copy link
Contributor

YaLTeR commented Oct 7, 2025

It doesn't fail somewhere down the line with this, right?

@he1senbrg
Copy link
Author

Based on my testing so far, it doesn’t fail. I tested it with:

Rectangle::<i32, Physical>::new((0, 0).into(), (1920, 35791423).into()),
Rectangle::<i32, Physical>::new((100, 100).into(), (800, 600).into()),

and

Rectangle::<i32, Physical>::new((0, 0).into(), (1920, 1000).into()),
Rectangle::<i32, Physical>::new((0, 35790423).into(), (1920, 1000).into()),

@he1senbrg
Copy link
Author

@YaLTeR Does this look good, or is there anything I should update?

@YaLTeR
Copy link
Contributor

YaLTeR commented Oct 9, 2025

I'll leave to smithay maintainers to check; I'm not actually familiar with this code

@he1senbrg
Copy link
Author

@Drakulix When you have a moment, could you please take a look at this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integer overflows in the damage shaper

2 participants